package com.costeaalex.datedrivenfilecopy.model.copiers;

/**
 * @author Alex Costea
 * 
 * Class that handles copying operations on the local system.
 * 
 */

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;

import com.costeaalex.datedrivenfilecopy.model.interfaces.ICopier;

public class NormalCopier implements ICopier {

	@Override
	public void init() {
				
	}

	@Override
	public boolean copyDirectory(String path) {
		return true;
	}

	@Override
	public boolean copyFile(String fromPath, String toPath) {
		try {
			Files.createDirectories(Paths.get(toPath).getParent());
			Files.copy(Paths.get(fromPath), Paths.get(toPath), StandardCopyOption.REPLACE_EXISTING);
			return true;
		} catch (IOException e) {
			e.printStackTrace();
			return false;
		}
	}

	@Override
	public void destroy() {
		
	}

}
